#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project ：auto-test 
@File    ：AccountPage.py
@Author  ：赵加响
@Date    ：2022/12/27 9:57 
@Desc    ：
"""

from selenium.webdriver.common.by import By

from base.AccountBase import AccountBase
from base.ObjectMap import ObjectMap
from common.tools import get_image_path


class AccountPage(ObjectMap, AccountBase):

    def upload_avatar(self, driver, image_name):
        """
        上传头像
        :param driver:
        :param image_name:
        :return:
        """
        image_path = get_image_path(image_name)
        upload_xpath = self.basic_info_avatar_input()
        return self.upload(driver, By.XPATH, upload_xpath, image_path)

    def click_save(self, driver):
        """
        点击保存按钮
        :param driver:
        :return:
        """
        button_xpath = self.basic_info_save_button()
        return self.element_click(driver, By.XPATH, button_xpath)
